
const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n' +
  '2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ=='

// #ifndef MP-WEIXIN
import { JSEncrypt }  from 'jsencrypt'
const encryptor = new JSEncrypt();
// #endif

// #ifdef MP-WEIXIN
import WxmpRsa from 'wxmp-rsa'
const encryptor = new WxmpRsa()
// #endif


export function encrypt(txt) {
  encryptor.setPublicKey(publicKey) // 设置公钥
  return encryptor.encrypt(txt) // 对需要加密的数据进行加密
}